#include <iostream>
#include <algorithm>
#include <vector>
#include <ctime>
using std::cin;
using std::cout;
using std::vector;
using std::swap;
using std::distance;
using std::pair;
using std::make_pair;

void Input(vector <int> *list) {
    int count;
    cin >> count;
    list->reserve(count);
    int element;
    for (int i(0); i < count; ++i) {
        cin >> element;
        list->push_back(element);
    }
}

void Output(vector <int>::iterator iterator_begin,
    vector <int>::iterator iterator_end) {
    for (auto i = iterator_begin; i != iterator_end; ++i) {
        cout << *i << " ";
    }
}

template <typename type = int, typename iterator = vector <int>::iterator>
pair <iterator, iterator> Partition(iterator iterator_begin,
    iterator iterator_end, type pivot) {
    if (iterator_begin == iterator_end) {
        return make_pair(iterator_begin, iterator_begin);
    }
    iterator iterator_first = iterator_begin;
    iterator iterator_last = iterator_end;
    auto iterator_current = iterator_begin;
    while (iterator_current != iterator_last) {
        if (*iterator_current < pivot) {
            iter_swap(iterator_current, iterator_first);
            ++iterator_first;
            ++iterator_current;
        }
        else if (*iterator_current > pivot) {
            --iterator_last;
            iter_swap(iterator_current, iterator_last);
        }
        else {
            ++iterator_current;
        }

    }
    iterator iterator_second = iterator_first;
    iterator_current = iterator_first;
    while (iterator_current != iterator_end) {
        if (*iterator_current == pivot) {
            iter_swap(iterator_current, iterator_second);
            ++iterator_second;
        }
        ++iterator_current;
    }
    return make_pair (iterator_first, iterator_second);
}

template <typename iterator = vector <int>::iterator>
void Sort_quick(iterator iterator_begin, iterator iterator_end) {
    if (distance(iterator_begin, iterator_end) > 1) {
        int pivot = *(iterator_begin + ((long long)rand() * (long long)rand()) %
            distance(iterator_begin, iterator_end));
        auto iterator_pair = Partition(iterator_begin, iterator_end,
            pivot);
        Sort_quick(iterator_begin, iterator_pair.first);
        Sort_quick(iterator_pair.second, iterator_end);
    }
}

int main() {
    srand(time(NULL));
    vector <int> list;
    Input(&list);
    Sort_quick(list.begin(), list.end());
    Output(list.begin(), list.end());
}